//
//  KHProgressView.m
//  KissHealth
//
//  Created by Mark on 2017/1/12.
//  Copyright © 2017年 Mark. All rights reserved.
//

#import "KHProgressView.h"

@interface KHProgressView ()

@end
@implementation KHProgressView


- (void)setProgress:(CGFloat)progress{
    _progress = progress;
    [self setNeedsDisplay];
}

- (void)drawRect:(CGRect)rect {
    [super drawRect:rect];
    CGPoint center = CGPointMake(rect.size.width * 0.5, rect.size.height * 0.5);
    CGFloat radius = rect.size.width * 0.5 -3;
    CGFloat startAngle = (-M_PI_2);
    CGFloat endAngel = 2 *M_PI * self.progress + startAngle;
    
    UIBezierPath *path = [UIBezierPath bezierPathWithArcCenter:center radius:radius startAngle:startAngle endAngle:endAngel clockwise:true];
    [path addLineToPoint:center];
    [path closePath];
    [[UIColor colorWithWhite:1.0 alpha:0.4] setFill];
    [path fill];
    
}


@end
